package com.gamex.findit.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gamex.findit.dao.SkillMapper;
import com.gamex.findit.model.Skill;
import com.gamex.findit.service.SkillService;

/**
 * 스킬 서비스
 * @author james
 *
 */
@Service
public class SkillServiceImpl implements SkillService{
	
	private static final Logger logger = LoggerFactory.getLogger(SkillServiceImpl.class);

	@Autowired SkillMapper SkillMapper;
	
	@Override
	public List<Skill> getSkill(Skill skill) throws Exception{
		List<Skill> result = null;
		try {
			result = SkillMapper.selectSkill(skill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

	@Override
	public int getSkillCount(Skill Skill) throws Exception{
		int count = 0;
		try {
			count = SkillMapper.selectSkillCount(Skill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return count;
	}

	@Override
	public Skill getSkillView(int skillId) throws Exception{
		Skill result = null;
		try {
			result = SkillMapper.selectSkillView(skillId);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

	@Override
	public void insertSkill(Skill skill) throws Exception{
		try {
			SkillMapper.insertSkill(skill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
	}

	@Override
	public void updateSkill(Skill skill) throws Exception{
		try {
			SkillMapper.updateSkill(skill);
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		
	}

	@Override
	public void deleteSkill(int skillId) {
		try {
			SkillMapper.deleteSkill(skillId);
		} catch (Exception e) {
			logger.error(e.getMessage());
		}
		
	}

	@Override
	public List<Skill> getSkillIds() throws Exception {
		List<Skill> result = null;
		try {
			result = SkillMapper.selectSkillIds();
		} catch (Exception e) {
			logger.error(e.getMessage());
			throw e;
		}
		return result;
	}

}
